package com.jel.WiKikonwledge.bean;

import com.alibaba.fastjson.JSONObject;

import java.util.List;

public class graph {
    String id;
    String name;
    List<graph> children;
    @Override
    public String toString() {
        return "graph{" +
                "id='" + id + '\'' +
                ", name='" + name + '\'' +
                ", chidren=" + children +
                '}';
    }

    public graph() {
    }
    public graph(String id, String name, List<graph> chidren) {
        this.id = id;
        this.name = name;
        this.children = chidren;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<graph> getChidren() {
        return children;
    }

    public void setChidren(List<graph> chidren) {
        this.children = chidren;
    }

    public String get_label(JSONObject vertice) {
        if (vertice.containsKey("labels")) {
            if (vertice.getJSONObject("labels").containsKey("zh-cn")) {
                return vertice.getJSONObject("labels").getString("zh-cn");
            } else if (vertice.getJSONObject("labels").containsKey("en")) {
                return vertice.getJSONObject("labels").getString("zh-cn");
            } else {
                return "null";
            }
        }
        return null;
    }
}
